package cn.tedu.boot11.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@Controller
public class HelloController {
   /* @RequestMapping("/hello")
    public void hello(HttpServletResponse response) throws IOException {
        System.out.println("服务器收到请求");
        response.setContentType("text/html;charset=utf-8");
        //获取输出对象  异常抛出
        PrintWriter pw = response.getWriter();
        //给客户端响应数据
        pw.write("测试成功");
        pw.close();

    }*/
    @RequestMapping("/hello")
    @ResponseBody // 该注解作用:可以通过返回值的方式给客户端响应数据
    public  void  hello(){
        System.out.println("又成功");
    }
}
